﻿<cms-page-header cms-title="Site Settings"></cms-page-header>

<cms-form cms-name="mainForm"
          cms-edit-mode="vm.editMode"
          ng-submit="vm.save()"
          cms-loading="vm.formLoadState.isLoading">

    <!-- Default toolbar -->
    <cms-page-actions ng-show="!vm.editMode">
        <cms-button class="main-cta"
                    cms-text="Edit"
                    ng-if="::vm.canUpdateSettings"
                    ng-click="vm.edit()"
                    ng-show="!vm.editMode"
                    ng-disabled="vm.globalLoadState.isLoading"></cms-button>

        <cms-button cms-text="Clear Cache"
                    ng-if="::vm.canUpdateSettings"
                    ng-click="vm.clearCache()"
                    ng-show="!vm.editMode"
                    ng-disabled="vm.globalLoadState.isLoading"></cms-button>
    </cms-page-actions>

    <!-- Edit mode toolbar -->
    <cms-page-actions ng-show="vm.editMode">
        <cms-button-submit cms-text="Save"
                           ng-show="vm.editMode"
                           ng-disabled="vm.mainForm.$invalid || vm.globalLoadState.isLoading"
                           cms-loading="vm.saveLoadState.isLoading"></cms-button-submit>
        
        <cms-button cms-text="Cancel"
                    ng-click="vm.cancel()"
                    ng-show="vm.editMode"
                    ng-disabled="vm.globalLoadState.isLoading"></cms-button>

    </cms-page-actions>

    <!-- Scrollable content area -->
    <cms-page-body cms-content-type="form">

        <cms-form-status></cms-form-status>

        <!--MAIN-->
        <cms-form-section cms-title="General">

            <cms-form-field-text cms-title="Application Name"
                                 cms-model="vm.generalSettingsCommand.applicationName"
                                 maxlength="100"
                                 required></cms-form-field-text>

            <cms-form-field-checkbox cms-title="Allow Automatic Updates"
                                     cms-model="vm.generalSettingsCommand.allowAutomaticUpdates"
                                     cms-description="If this is disabled then any attempt to update the database automatically will cause an error. Switch this off when a website is live and is not being actively developed to prevent accidental database changes."></cms-form-field-checkbox>

        </cms-form-section>

        <!--MAIN-->
        <cms-form-section cms-title="Seo">
            
            <cms-form-field-text-area cms-title="Robots.txt"
                                      cms-model="vm.seoSettingsCommand.robotsTxt"
                                      cms-description="This file gives instructions about this site to search engines and other robots."></cms-form-field-text-area>

            <cms-form-field-text-area cms-title="Humans.txt"
                                      cms-model="vm.seoSettingsCommand.humansTxt"
                                      cms-description="A TXT file that contains information about the different people who have contributed to building the website."></cms-form-field-text-area>

        </cms-form-section>

    </cms-page-body>

</cms-form>


